home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / DiceSource / include / assert.h < prev    next >
C/C++ Source or Header  |  1994-02-01  |  718b  |  38 lines

  1.  
  2. /*
  3.  * $VER: assert.h 1.0 (17.4.93)
  4.  *
  5.  * (c)Copyright 1992 Obvious Implementations Corp, All Rights Reserved
  6.  *
  7.  *  relatively optimized, takes advantage of GNU-cpp __BASE_FILE__ macro
  8.  *  allowing us to store the filename string once in a static decl.
  9.  */
  10.  
  11. #ifndef ASSERT_H
  12. #define ASSERT_H
  13.  
  14. static char *__BaseFile = __BASE_FILE__;
  15.  
  16. extern void __FailedAssert(char *, int);
  17.  
  18. #endif
  19.  
  20. /*
  21.  *  if user has not overriden our assert, we define it.  We must handle
  22.  *  the possibility of redefinition.
  23.  */
  24.  
  25. #ifdef _ASSERT_IS_LOCAL
  26. #undef assert
  27. #endif
  28.  
  29. #ifndef assert
  30. #define _ASSERT_IS_LOCAL
  31. #ifdef NDEBUG
  32. #define assert(ignore)
  33. #else
  34. #define assert(exp)    if (!(exp)) __FailedAssert( __BaseFile, __LINE__);
  35. #endif
  36. #endif
  37.  
  38.